﻿using System;

namespace Talented.Core.Entities.Talents.Abstract
{
	public abstract class TalentBase
	{
		#region Enums
		public enum TierEnum
		{
			Empty,
			One,
			Two,
			Three,
			Four,
			Five,
			Six
		}

		[Flags]
		public enum PropertyEnum
		{
			NotReplaceable,
			NotUpgradeable,
			Active
		}
		#endregion

		#region Properties
		private Guid _guid;
		private double _cost;

		public TierEnum Tier { get; protected set; }
		public PropertyEnum Properties { get; protected set; }
		public double Cost
		{
			get { return _cost; }
			protected set
			{
				if (value < 0)
					throw new ArgumentOutOfRangeException();

				_cost = value;
			}
		}
		
		public Guid Guid
		{
			get { return _guid; }
			protected set
			{
				if (value == Guid.Empty)
					throw new ArgumentException();

				_guid = value;
			}
		}
		#endregion

		#region Constructors
		protected TalentBase(Guid guid)
		{
			Guid = guid;
		}
		#endregion

		#region Methods
		public virtual bool ContainsProperties(PropertyEnum properties)
		{
			return Properties.HasFlag(properties);
		}
		#endregion
	}
}
